import { getIndicesHtml } from "@/services/weather";
import { defineStore } from "pinia";

const useIndicesStore = defineStore("indices", {
  state: () => ({
    indices: [],
    currentIndex: 0,
  }),
  actions: {
    async fetchIndicesData(city, code) {
      const res = await getIndicesHtml(city, code);
      this.indices = res;
    },
    async fetchCurrentIndex(index) {
      this.currentIndex = index;
    },
  },
});

export default useIndicesStore;
